#!/bin/bash
# Script to calculate the band structure of Graphene

# Get the number of processors, by default, 1
if [ "$#" -ge 1 ]; then
   np=$1
else
   np=4
fi

# set the environment
. ../../0-tools/environment

# Step 1: structural relaxation
cp POSCAR POSCAR.orig
rm -rf INCAR KPOINTS
ln -s INCAR.relax INCAR
ln -s KPOINTS.01 KPOINTS

mpirun -np ${np} ${VASP}
mv OUTCAR OUTCAR.01

# Step 2: static for relaxed
rm -rf INCAR
ln -s INCAR.static INCAR
cp CONTCAR POSCAR

mpirun -np ${np} ${VASP}
mv OUTCAR OUTCAR.02

# Step 3: NSCF calculation (band structure, line mode)
rm -rf INCAR KPOINTS
ln -s INCAR.bs INCAR
ln -s KPOINTS.02 KPOINTS

mpirun -np ${np} ${VASP}
cp OUTCAR OUTCAR.03

# clean up
rm -rf CHG CONTCAR OSZICAR PBS.batch PCDAT XDATCAR REPORT
